---
title: 使用 kubectl 创建 Deployment
weight: 10
---

<!DOCTYPE html>

<html lang="en">

<body>

<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">

<div class="layout" id="top">

    <main class="content">

        <div class="row">

         <div class="col-md-8">
          <!-- <h3>Objectives</h3> -->
          <h3>目标</h3>
                <!-- <ul>
                    <li>Learn about application Deployments.</li>
                    <li>Deploy your first app on Kubernetes with kubectl.</li>
                </ul> -->
                <ul>
                  <li>学习了解应用的部署</li>
                  <li>使用 kubectl 在 Kubernetes 上部署第一个应用</li>
              </ul>
            </div>

            <div class="col-md-8">
                <!-- <h3>Kubernetes Deployments</h3> -->
                <h3>Kubernetes 部署</h3>
                <!-- <p>
                Once you have a running Kubernetes cluster, you can deploy your containerized applications on top of it.
                To do so, you create a Kubernetes <b>Deployment</b> configuration. The Deployment instructs Kubernetes
                how to create and update instances of your application. Once you've created a Deployment, the Kubernetes
                master schedules mentioned application instances onto individual Nodes in the cluster.
                </p> -->
                <p>
                  一旦运行了 Kubernetes 集群，就可以在其上部署容器化应用程序。
                  为此，您需要创建 Kubernetes <b> Deployment </b>配置。Deployment 指挥 Kubernetes 如何创建和更新应用程序的实例。创建 Deployment 后，Kubernetes master 将应用程序实例调度到集群中的各个节点上。
                  </p>

                <!-- <p>Once the application instances are created, a Kubernetes Deployment Controller continuously monitors those instances. If the Node hosting an instance goes down or is deleted, the Deployment controller replaces the instance with an instance on another Node in the cluster. <b>This provides a self-healing mechanism to address machine failure or maintenance.</b></p> -->
                <p>创建应用程序实例后，Kubernetes Deployment 控制器会持续监视这些实例。 如果托管实例的节点关闭或被删除，则 Deployment 控制器会将该实例替换为群集中另一个节点上的实例。 <b>这提供了一种自我修复机制来解决机器故障维护问题。</b></p>

                <!-- <p>In a pre-orchestration world, installation scripts would often be used to start applications, but they did not allow recovery from machine failure.  By both creating your application instances and keeping them running across Nodes, Kubernetes Deployments provide a fundamentally different approach to application management. </p> -->
                <p>在没有 Kubernetes 这种编排系统之前，安装脚本通常用于启动应用程序，但它们不允许从机器故障中恢复。通过创建应用程序实例并使它们在节点之间运行， Kubernetes Deployments 提供了一种与众不同的应用程序管理方法。</p>

            </div>

            <div class="col-md-4">
                <div class="content__box content__box_lined">
                    <!-- <h3>Summary:</h3> -->
                    <h3>总结:</h3>
                    <ul>
                        <li>Deployments</li>
                        <li>Kubectl</li>
                    </ul>
                </div>
                <div class="content__box content__box_fill">
                    <!-- <p><i>
                        A Deployment is responsible for creating and updating instances of your application
                    </i></p> -->
                    <p><i>
                      Deployment 负责创建和更新应用程序的实例
                  </i></p>
                </div>
            </div>
        </div>
        <br>

        <div class="row">
            <div class="col-md-8">
                <!-- <h2 style="color: #3771e3;">Deploying your first app on Kubernetes</h2> -->
                <h2 style="color: #3771e3;">部署你在 Kubernetes 上的第一个应用程序</h2>
            </div>
        </div>

        <div class="row">
            <div class="col-md-8">
                <p><img src="/docs/tutorials/kubernetes-basics/public/images/module_02_first_app.svg"></p>
            </div>
        </div>
        <br>

        <div class="row">
            <div class="col-md-8">

                <!-- <p>You can create and manage a Deployment by using the Kubernetes command line interface, <b>Kubectl</b>. Kubectl uses the Kubernetes API to interact with the cluster. In this module, you'll learn the most common Kubectl commands needed to create Deployments that run your applications on a Kubernetes cluster.</p> -->
                <p>您可以使用 Kubernetes 命令行界面创建和管理 Deployment，<b>Kubectl</b>.Kubectl 使用 Kubernetes API 与集群进行交互。在本单元中，您将学习创建在 Kubernetes 集群上运行应用程序的 Deployment 所需的最常见的 Kubectl 命令。</p>

                <!-- <p>When you create a Deployment, you'll need to specify the container image for your application and the number of replicas that you want to run. You can change that information later by updating your Deployment; Modules <a href="/docs/tutorials/kubernetes-basics/scale-intro/">5</a> and <a href="/docs/tutorials/kubernetes-basics/update-intro/">6</a> of the bootcamp discuss how you can scale and update your Deployments.</p> -->
                <p>创建 Deployment 时，您需要指定应用程序的容器映像以及要运行的副本数。您可以稍后通过更新 Deployment 来更改该信息; 模块 <a href="/docs/tutorials/kubernetes-basics/scale-intro/">5</a> 和 <a href="/docs/tutorials/kubernetes-basics/update-intro/">6</a> 讨论了如何扩展和更新 Deployments。</p>

            </div>
            <div class="col-md-4">
                <div class="content__box content__box_fill">
                    <!-- <p><i> Applications need to be packaged into one of the supported container formats in order to be deployed on Kubernetes </i></p> -->
                    <p><i> 应用程序需要打包成一种受支持的容器格式，以便部署在 Kubernetes 上 </i></p>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-8">

                <!-- <p>For our first Deployment, we'll use a Node.js application packaged in a Docker container.
                    To create the Node.js application and deploy the Docker container, follow the instructions from the
                    <a href="/docs/tutorials/hello-minikube/">Hello Minikube tutorial</a>.</p>

                <p>Now that you know what Deployments are, let's go to the online tutorial and deploy our first app!</p> -->
                <p>对于我们的第一次部署，我们将使用打包在 Docker 容器中的 Node.js 应用程序。
                    要创建 Node.js 应用程序并部署 Docker 容器，请按照
                    <a href="/docs/tutorials/hello-minikube/">你好 Minikube 教程</a>.</p>

                <p>现在您已经了解了 Deployment 的内容，让我们转到在线教程并部署我们的第一个应用程序！</p>
            </div>
        </div>
        <br>

        <div class="row">
            <div class="col-md-12">
                <a class="btn btn-lg btn-success" href="/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive/" role="button">开始交互式教程 <span class="btn__next">›</span></a>
            </div>
        </div>

    </main>

</div>

</body>
</html>